package weapons;
import iterfaces.Ships;

import javax.xml.bind.SchemaOutputResolver;

import controllers.Map;
import controllers.Point;
import controllers.State;

import ships.Destroyer;
import ships.Frigate;
import ships.Hunter;

/**
 * @author 508461
 * @version 1.0
 * @created 25-mei-2012 9:14:41
 */
public class SoundBuoyLauncher extends Weaponsystem {

	public SoundBuoy soundBuoy;
	private Ships ship;
	private static final int MAGAZINE_SIZE 						= 1;
	private static final int MAX_HEALTHPOINTS_BEFORE_SHUTDOWN	= 0; //in %
	private static final int RELOAD_TIME 						= 10; //sec	
	private static final int MAGAZINE_AMOUNT 					= 4;
	private static final int FIRE_RATE 							= 1; //= 1 per keer
	private int remainingBullets;

	public static void main(String[] args){
		// Test de verbonden classes.
		new SoundBuoyLauncher();
	}
	
	public SoundBuoyLauncher(){
		super(State.Online , MAGAZINE_SIZE, MAX_HEALTHPOINTS_BEFORE_SHUTDOWN, RELOAD_TIME, MAGAZINE_AMOUNT, FIRE_RATE);
		System.out.println("Instance " + this.getClass() + " created.");
	}
	
	public SoundBuoyLauncher(Ships ship){
		super(State.Online , MAGAZINE_SIZE, MAX_HEALTHPOINTS_BEFORE_SHUTDOWN, RELOAD_TIME, MAGAZINE_AMOUNT, FIRE_RATE);
		this.ship = ship;
		System.out.println("Instance " + this.getClass() + " created.");
	}
	
	public int getRemainingBullets(){
		return this.remainingBullets;
	}
	
	public void setRemainingBullets(int remainingBullets)
	{
		this.remainingBullets = remainingBullets;
	}

	public void shoot(Point point, Point shoot){
		Bullet soundBuoy = new SoundBuoy(this.ship.getPosition());
		//soundBuoy.addWaypoint(soundBuoy, new Point(100,100));
		soundBuoy.setDrawWaypoints(false);
		Map.getMap().addDrawAbleObject(soundBuoy);
		//Map.getMap().dObjects.get(Map.getMap().dObjects.size()-1).addWaypoint(Map.getMap().dObjects.get(Map.getMap().dObjects.size()-1), shoot);
		soundBuoy.addWaypoint(soundBuoy, shoot);
	}

	public void finalize() throws Throwable {
		super.finalize();
	}

}